/**
 * Created by 李海强1 on 2016/10/10.
 */
Ext.define('UDZ.controller.Ctr_ClothDetail', {
    extend: 'Ext.app.Controller',
    init:function () { //初始化可以加载数据，但不可以对控制件进行操作
      // Ext.getCmp('btn_go').setText('gogogo') ;  //不可行，因为控件还没加载出来
    },
    config: {
        refs: { //关联
            clothdetailview:{
                     selector:'clothdetail',
                     xtype:'clothdetail',
                     autoCreate:true
                 },

              },
        control:{  //控制

        },
        routes: { //自己的路由
            'route_cloth_detail/:id': 'showClothDetail'
        },
    },
    func_backMain:function ( ) { //方法
     this.redirectTo('route_main');
    },
    showClothDetail:function (id) {
        Ext.Viewport.setActiveItem(this.getClothdetailview());

        //尺码表
        var size_data=[
            {size:'S',big:'160',color:'红色'},
            {size:'M',big:'165',color:'酒红色'},
            {size:'L',big:'170',color:'蓝色'},
            {size:'XL',big:'175',color:'白色'},
            {size:'XXL',big:'180',color:'藏青色'},
            {size:'XXXL',big:'185',color:'卡其色'},
            {size:'XXXXL',big:'190',color:'天空蓝'}
        ];

        var size_tpl=new Ext.XTemplate(
            '<div class="size_container">' +
            '<tpl for=".">' +
                '<div class="size_content">' +
                    '<span>{size}</span>/<span>{big}</span>'+
                '</div>'+
            '</tpl>'+
            '</div>'
        );
        var  size_content= size_tpl.apply(size_data);
        Ext.getCmp('size_table').setHtml(size_content);


        //颜色模版
        var color_tpl=new Ext.XTemplate(
            '<div class="size_container">' +
            '<tpl for=".">' +
            '<div class="size_content">' +
            '<span >{color}</span>'+
            '</div>'+
            '</tpl>'+
            '</div>'
        );
        var  color_content= color_tpl.apply(size_data);
        Ext.getCmp('color_table').setHtml(color_content);
    }
});